<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>设置/获取替代字符</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strwidth.html">mb_strwidth</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-substr-count.html">mb_substr_count</a></div>
 <div class="up"><a href="ref.mbstring.html">多字节字符串 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.mb-substitute-character" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_substitute_character</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.6, PHP 5)</p><p class="refpurpose"><span class="refname">mb_substitute_character</span> &mdash; <span class="dc-title">设置/获取替代字符</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mb-substitute-character-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>mb_substitute_character</strong></span>
    ([ <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$substrchar</code></span>
  ] )</div>

  <p class="para rdfs-comment">
   当输入字符的编码是无效的，或者字符代码不存在于输出的字符编码中时，可以为其指定一个替代字符。
   无效字符可以被替换为 <strong><code>NULL</code></strong>（不输出）、<span class="type"><a href="language.types.string.html" class="type string">string</a></span> 或者 <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> 值（Unicode 字符代码的值）。
  </p>
  <p class="para">
   该设置会影响 <span class="function"><a href="function.mb-convert-encoding.html" class="function">mb_convert_encoding()</a></span>、
   <span class="function"><a href="function.mb-convert-variables.html" class="function">mb_convert_variables()</a></span>、
   <span class="function"><a href="function.mb-output-handler.html" class="function">mb_output_handler()</a></span>
   和 <span class="function"><a href="function.mb-send-mail.html" class="function">mb_send_mail()</a></span>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-substitute-character-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">substrchar</code></em></dt>

     <dd>

      <p class="para">
       指定 Unicode 值为一个 <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span>，或者是以下<span class="type"><span class="type 字符串">字符串</span></span>中的一个：
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          &quot;none&quot;：不输出
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          &quot;long&quot;：输出字符代码的值（比如：U+3000、JIS+7E7E）
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          &quot;entity&quot;：输出字符的实体（比如：Ȁ）
         </span>
        </li>
       </ul>
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-substitute-character-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果设置了 <em><code class="parameter">substchar</code></em>，在成功时返回 <strong><code>TRUE</code></strong>，失败时返回 <strong><code>FALSE</code></strong>。
   如果没有设置 <em><code class="parameter">substchar</code></em>，它将返回 Unicode 值或者 &quot;<em>none</em>&quot; 或 &quot;<em>long</em>&quot;。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.mb-substitute-character-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2658">
    <p><strong>Example #1 <span class="function"><strong>mb_substitute_character()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;设置为&nbsp;Unicode&nbsp;U+3013&nbsp;(GETA&nbsp;MARK)&nbsp;*/<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #0000BB">0x3013</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;设置十六进制格式&nbsp;*/<br /></span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">(</span><span style="color: #DD0000">"long"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;显示当前设置&nbsp;*/<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">mb_substitute_character</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.mb-strwidth.html">mb_strwidth</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.mb-substr-count.html">mb_substr_count</a></div>
 <div class="up"><a href="ref.mbstring.html">多字节字符串 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
